<%@page import="com.xnx3.j2ee.Global"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<jsp:include page="/wm/common/head.jsp">
	<jsp:param name="title" value="数据统计骑手考勤分析" />
</jsp:include>
<div style="height: 10px;"></div>
<jsp:include page="/wm/common/list/formSearch_formStart.jsp"></jsp:include>
<label style="text-align: left;" class="layui-form-label">日期范围</label>
<div class="layui-input-inline">
	<jsp:include page="/wm/common/edit/form_datebmrq.jsp">
		<jsp:param name="wm_name" value="startTime" />
		<jsp:param name="wm_value" value="${entity.selecttime }" />
		<jsp:param name="wm_type" value="date" />
	</jsp:include>
</div>
&nbsp;-&nbsp;
<div class="layui-input-inline">
	<jsp:include page="/wm/common/edit/form_datebmrq.jsp">
		<jsp:param name="wm_name" value="endTime" />
		<jsp:param name="wm_value" value="${entity.selecttime }" />
		<jsp:param name="wm_type" value="date" />
	</jsp:include>
</div>
<a class="layui-btn"
	href="javascript:wm.list(1,'/superadmin/statistics/getRiderAnalyze.json');"
	style="margin-left: 15px;">搜索</a>
<a class="layui-btn" onclick="getChengdanExecl();">导出excel</a>

</form>
<style>
.iw_table {
	width: 96vw;
	margin: 0 auto 40px;
}
</style>
<table class="aui-table-responsive layui-table iw_table"
	style="min-width: 900px;" id="orderfenxi">
	<thead>
		<tr>
			<th width="50px" style="text-align: center;">骑手名字</th>
			<th width="50px" style="text-align: center;">请假次数</th>
			<th width="50px" style="text-align: center;">请假时长(时)</th>
			<th width="50px" style="text-align: center;">操作</th>
		</tr>
	</thead>
	<tbody id="tbody">
		<tr v-for="item in list">
			<td style="text-align: center;">{{item.qishouName}}</td>
			<td style="text-align: center;">{{item.numSum}}</td>
			<td style="text-align: center;">{{item.timeSum.toFixed(2)}}</td>
			<td style="text-align: center;">{{item.numSum>0?"缺勤":"全勤"}}</td>
		</tr>

	</tbody>
</table>

</form>
<!-- 通用分页跳转 -->
<jsp:include page="/wm/common/page.jsp"></jsp:include>
<script type="text/javascript">

/**
 * 对象转url参数
 * @param {*} data,对象
 * @param {*} isPrefix,是否自动加上"?"
 */
function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
    let prefix = isPrefix ? '?' : ''
    let _result = []
    if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
    for (let key in data) {
        let value = data[key]
        // 去掉为空的参数
        if (['', undefined, null].indexOf(value) >= 0) {
            continue;
        }
        // 如果值为数组，另行处理
        if (value.constructor === Array) {
            // e.g. {ids: [1, 2, 3]}
            switch (arrayFormat) {
                case 'indices':
                    // 结果: ids[0]=1&ids[1]=2&ids[2]=3
                    for (let i = 0; i < value.length; i++) {
                        _result.push(key + '[' + i + ']=' + value[i])
                    }
                    break;
                case 'brackets':
                    // 结果: ids[]=1&ids[]=2&ids[]=3
                    value.forEach(_value => {
                        _result.push(key + '[]=' + _value)
                    })
                    break;
                case 'repeat':
                    // 结果: ids=1&ids=2&ids=3
                    value.forEach(_value => {
                        _result.push(key + '=' + _value)
                    })
                    break;
                case 'comma':
                    // 结果: ids=1,2,3
                    let commaStr = "";
                    value.forEach(_value => {
                        commaStr += (commaStr ? "," : "") + _value;
                    })
                    _result.push(key + '=' + commaStr)
                    break;
                default:
                    value.forEach(_value => {
                        _result.push(key + '[]=' + _value)
                    })
            }
        } else {
            _result.push(key + '=' + value)
        }
    }
    return _result.length ? prefix + _result.join('&') : ''
}


//导出execl
function getChengdanExecl(){
	var data = wm.getJsonObjectByForm($('.toubu_xnx3_search_form'));
	 window.open('/superadmin/outdoc/getRiderDataExecl.json' + queryParams(data)); 
} 

//刚进入这个页面，自动加载第一页的数据
wm.list(1,'/superadmin/statistics/getRiderAnalyze.json');
</script>
<jsp:include page="/wm/common/foot.jsp"></jsp:include>